
        
package com.mall.order.config;


import com.ctg.mse.common.cache.RedisSingle;
import io.lettuce.core.RedisClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: redis配置
 * @Author: zhouzhao
 * @CreateTime: 2022/10/19 10:38:29
 */
@Configuration
public class RedisConfig {

    /**
     * 单节点redis地址
     */
    @Value("${redis.base.single.demo.nodes}")
    private String singleNode;

    @Value("${redis.base.single.demo.password}")
    private String password;

    /**
     * JetCache 依赖一个redis client注入
     *
     * @return
     */
    @Bean
    public RedisClient intJetCache(RedisSingle redisSingle) {
        return redisSingle.getClient();
    }

    /**
     * 初始化一个Sentinel 的master client
     *
     * @return
     */
    @Bean
    public RedisSingle initSingleClient() {
        return new RedisSingle(singleNode,password,10000);
    }


}
